/**
 * @date 2006-8-24
 */

package org.nanhill.moo.web;

import javax.servlet.http.HttpServletRequest;

import org.nanhill.moo.domain.User;

/**
 * @author alin [xalinx at gmail dot com]
 * @date 2006-8-24
 */
public class UserSession {
	private User login;

	public User getLogin() {
		return login;
	}

	public void setLogin(User login) {
		this.login = login;
	}

	public static void initUserSession(User login, HttpServletRequest request) {
		UserSession us = new UserSession();
		us.setLogin(login);
		request.getSession().setAttribute(WebNameSpace.USER_SESSION, us);
	}

	public static UserSession getUserSession(HttpServletRequest request) {
		UserSession us = (UserSession) request.getSession().getAttribute(
				WebNameSpace.USER_SESSION);
		return us;
	}
}
